<?php
	//fil d'ariane
	$ariane = array(
		array(
			'href' => "index.php",
			'name' => "Home"
		),
		array(
			'href' => "adm_home.php",
			'name' => "Admin"
		),
		array(
			'href' => "adm_records.php",
			'name' => "Records moderation"
		)
	);
	
	require("include/includes.php");
	require("include/getIP.php");
	
	// CHECK IF THE USER CAN SEE THE PAGE
	if(!checkRights(VALIDATOR))
	{
		die('Permission denied');
	}
	
	// Valeurs initiales
	$valueTrack 		= postOrCustom('track', '');
	$errors = Array();
	//$records = Record::getAllForState(PENDING);
	$records = Record::getAllForState(REFUSED);
	
	/// --- VALIDATION DU FORMULAIRE ---
	if(isset($_POST['submit']))
	{
		if(!verifyCsrfToken())
		{
			$errors['csrf'] = 'Security token missing!';
		}
		
		if(empty($errors)) // CSRF ok
		{
		}

		
	}
	
	$template = $twig->loadTemplate('admin/records.html');
	$template->display(array(
		'pageTitle' 		=> 'Times moderation',
		'records'			=> $records,
		'errors'			=> $errors
	));
?>